<script type="text/html" template
        lay-url="{{ window.globalConfig.url_faq + '/' + layui.router().search.id }}"
        lay-done="layui.data.done(d);">
    <title>产品详情</title>

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">
                        <a href="javascript:history.back()"
                           class="layui-btn layui-btn-primary layui-btn-sm" id="goBack">返回上级</a>
                        {{ d.data.name }}
                    </div>
                    <div class="layui-card-body">

                        <div class="layui-form" lay-filter="LAY-home-faq-listform"
                             id="LAY-home-faq-listform"
                             style="padding: 20px 30px 0 0;">

                            <div class="layui-tab layui-tab-brief">
                                <ul class="layui-tab-title">
                                    <li class="layui-this">基础信息</li>
                                </ul>
                                <div class="layui-tab-content">

                                    <!-- 基础信息 -->
                                    <div class="layui-tab-item layui-show">
                                        <!-- 问答类型 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">问答类型</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="catName" value=""
                                                       class="layui-input" readonly/>
                                                <input type="hidden" id="catId" name="cat_id"
                                                       value="{{ d.data.cat_id }}"
                                                       class="layui-input"/>
                                            </div>
                                        </div>

                                        <!-- 问题 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">问题</label>
                                            <div class="layui-input-inline">
                                            <textarea name="question"
                                                      style="width: 600px; height: 150px;"
                                                      autocomplete="off"
                                                      class="layui-textarea"
                                                      placeholder="请输入问题">{{ d.data.question || '' }}</textarea>
                                            </div>
                                        </div>

                                        <!--  关联文章  -->
<!--                                        <div class="layui-form-item">-->
<!--                                            <label class="layui-form-label">关联链接</label>-->
<!--                                            <div class="layui-input-inline" style="min-width: 250px;">-->
<!--                                                <input type="text" id="redirect_link" name="redirect_link" value="{{ d.data.redirect_link || '' }}"-->
<!--                                                       class="layui-input"/>-->
<!--                                            </div>-->
<!--                                        </div>-->

                                        <!--  答案  -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">答案</label>
                                            <div class="layui-input-inline" style="width: 100%">
                                                <div id="answer-editor"></div>
                                            </div>
                                        </div>

                                        <!-- 加精 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">是否加精</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="is_best" title="开启|关闭" value="1"
                                                       lay-skin="switch"
                                                       {{# if(d.data.is_best== undefined){d.data.is_best=1} }}
                                                       {{# if(d.data.is_best){ }}
                                                       checked
                                                       {{# } }}
                                                >
                                            </div>
                                        </div>

                                        <!-- 置顶 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">是否置顶</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="is_top" title="开启|关闭" value="1"
                                                       lay-skin="switch"
                                                       {{# if(d.data.is_top== undefined){d.data.is_top=1} }}
                                                       {{# if(d.data.is_top){ }}
                                                       checked
                                                       {{# } }}
                                                >
                                            </div>
                                        </div>

                                        <!-- 热门 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">是否热门</label>
                                            <div class="layui-input-inline">
                                                <input type="checkbox" name="is_hot" title="开启|关闭" value="1"
                                                       lay-skin="switch"
                                                       {{# if(d.data.is_hot== undefined){d.data.is_hot=1} }}
                                                       {{# if(d.data.is_hot){ }}
                                                       checked
                                                       {{# } }}
                                                >
                                            </div>
                                        </div>


                                        <!-- 排序 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">排序</label>
                                            <div class="layui-input-inline">
                                                <input type="number" name="sort" lay-affix="number" min="0"
                                                       value="{{ d.data.sort | 0 }}"
                                                       lay-verify="required|number" placeholder="请输入排序"
                                                       autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                        </div>


                                    </div>
                                </div>
                            </div>

                            <input type="hidden" name="id" value="{{ d.data.id }}">
                            <div class="layui-form-item">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline">
                                    <input type="button" lay-submit
                                           lay-filter="LAY-home-faq-listform-submit"
                                           value="保存"
                                           class="layui-btn">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>
<script src="res/modules/faq.js"></script>
